/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package server;

import engine.Player;
import engine.Singleton;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.List;

/**
 *
 * @author User
 */
public class ListenerServer {
    static final int PORT = 8888;
    public static void main(String[] args) throws IOException
    {
        OneForAllServer clients = new OneForAllServer();
        clients.start();
        ServerSocket s = new ServerSocket(PORT);
        System.out.println("Server For One Started");
        Singleton.getInstance();
        List<Player> c = Singleton.clients;
        
        try
        {
            while (true)
            {
                Socket socket = s.accept();
                Player p = new Player(clients, socket);
                c.add(p);
                
                    // тут новый player
            }
        }
        finally
        {
            s.close();
        }
    }
}
